<template>
	<view>
		<view class="zabj">
			<view @click="on_url('../../pages/banmi/user_set',1)" class="flex j-f pt2" style="padding-right: 60rpx;">
				<image style="width: 50rpx;height: 50rpx;" src="../../static/tab/shezhi.png" mode=""></image>
			</view>
			<view v-if="token" @click="on_url('../../pages/banmi/user_set',1)" class=" flex a-c"
				style="padding-top: 10rpx;padding-right: 60rpx;padding-left: 60rpx;">
				<view class="">
					<image class="q_y" v-if="user.face" :src="user.face" style="width: 130rpx;height: 130rpx;border:3px solid #fff;" mode="">
					</image>
					<image class="q_y" v-if="!user.face" src="../../static/login1/face.png"
						style="width: 130rpx;height: 130rpx;" mode=""></image>
				</view>
				<view class="ml20" style="margin-top: -10rpx;">
					<text class="w800" style="font-size: 40rpx;color: #fff;">{{user.nickname?user.nickname:'微信用户'}}</text>
			<!-- 		<view class="cff pt1">
						<text>Uid:{{user.uid}}</text>
					</view> -->
				</view>
				<view class="">
					当前余额：0
				</view>
			</view>
			
			<view v-if="!token" @click="on_url('../../pages/banmi/user_login',0)" class=" flex a-c"
				style="padding-top: 10rpx;padding-right: 60rpx;padding-left: 60rpx;">
				<view class="">
					<image class="q_y" src="../../static/login1/face.png" style="width: 130rpx;height: 130rpx;border:3px solid #fff;" >
					</image>
				</view>
				<view class="ml20" style="margin-top: -10rpx;">
					<text class="w800" style="font-size: 40rpx;color: #fff;">请登陆！</text>
					<view class="cff pt1">
						<text>Uid:000000</text>
					</view>
				</view>
			</view>

		</view>
		<!-- 底部区域 -->
		<view class="p2">
			<view class="p20 b_y" style="margin-top: -200rpx;background-color: #fff;">
				<view @click="on_url('../../pages/weimingpian/my_mingpian_sc',1)" class="p20    " style="background-color: #fff;padding-top: 40rpx;padding-bottom: 40rpx;">
					<view class="flex j-b a-c">
						<view class="flex a-c">
							<text class="iconfont f40 c_7">&#xe695;</text>
							<text class="ml1">我的活动</text>
						</view>
						<view class="">
							<image style="width: 30rpx;height: 30rpx;" src="../../static/tab/you.png" mode=""></image>
						</view>
					</view>
				</view>
			
				<view @click="on_url('../../pages/weimingpian/my_mingpian',1)" class="p20" style="padding-top: 40rpx;padding-bottom: 40rpx;">
					<view class="flex j-b a-c">
						<view class="flex a-c">
							<text class="iconfont f40 c_7">&#xe6bc;</text>
							<text class="ml1">我的名片</text>
						</view>
						<view class="">
							<image style="width: 30rpx;height: 30rpx;" src="../../static/tab/you.png" mode=""></image>
						</view>
					</view>
				</view>
				
				<view @click="article_view(10)" class="p20" style="padding-top: 40rpx;padding-bottom: 40rpx;">
					<view class="flex j-b a-c">
						<view class="flex a-c">
							<text class="iconfont f40 c_7">&#xe70f;</text>
							<text class="ml1">隐私条款</text>
						</view>
						<view class="">
							<image style="width: 30rpx;height: 30rpx;" src="../../static/tab/you.png" mode=""></image>
						</view>
					</view>
				</view>
				
				<view @click="article_view(11)" class="p20" style="padding-top: 40rpx;padding-bottom: 40rpx;">
					<view class="flex j-b a-c">
						<view class="flex a-c">
							<text class="iconfont f40 c_7">&#xe6fe;</text>
							<text class="ml1">关于我们</text>
						</view>
						<view class="">
							<image style="width: 30rpx;height: 30rpx;" src="../../static/tab/you.png" mode=""></image>
						</view>
					</view>
				</view>
			</view>
			
			
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				user: {},//用户信息
				token:uni.getStorageSync('token')?uni.getStorageSync('token');:''
			}
		},
		onLoad() {
			var that =this;
			this.$module.ifToken(res=>{
				this.init();//查询用户信息
			})
			// uni.$on('banmi_login', function(data) {
			// 	that.token = uni.getStorageSync('token');
			// 	that.init();
			// })
		},
		methods: {
			init() {//查询用户信息
				this.Htpp.user_info().then(ret => {
					if (ret) {
						this.user = ret.data.user;
						return
					}else{
						return
					}
				})
			},
			article_view(index) {//跳转页面
				uni.navigateTo({
					url: '/pages/banmi/article_view?id=' + index
				})
			},
			on_url(url,index) {
				console.log("index: " + JSON.stringify(index));
				if (index==1) {
					if (!uni.getStorageSync('token')) {
						 
						uni.navigateTo({
							url:'/pages/banmi/user_login'
						})
						return
					}  
				}  
				uni.navigateTo({
					url: url
				})
			}
		}
	}
</script>

<style>
	.zabj {
		background-size: 100% 100%;
		-moz-background-size: 100% 100%;
		height: 450rpx;
		background-repeat: no-repeat;
		background-image: url(../../static/bj/3.jpg);
		border-bottom-left-radius:50rpx;
		border-bottom-right-radius: 50rpx;
	}
</style>
